/*
 * @Author: HW
 * @file name: File name
 * @Date: 2022-04-24 10:09:58
 * @LastEditor: HW
 * @LastEditTime: 2022-04-24 10:17:21
 * @FilePath: \welfare-box-2.0\test.js
 * @Describe: 
 */
function buryingPointPostOwn(data) {
    let action_time = formatDateTime(); //获取当前时间
    let postData = {
      version_code: "V2.0.0", // 版本 固定不用改  必须传
      client_type: "mb-h5", // 客户端类型 固定不用改 必须传
      agent_code: "OT7G5XRJ", // 接入编码 固定不用改 必须传
      device_id: "12", // 用户编码 固定不用改 必须传
      action_time,  //必须传
      ...data
    };
    uni.request({
      url: "https://st.gd10010.cn/relycube/orbit/log",
      method: "post",
      data: JSON.stringify(postData),
      headers: {
        "Content-Type": "application/json",
      },
    })
  }
  //获取当前时间
  function formatDateTime() {
    let date = new Date();
    const year = date.getFullYear();
    const month = date.getMonth() + 1;
    const day = date.getDate();
    const hour = date.getHours();
    const minute = date.getMinutes();
    const second = date.getSeconds();
    const milliSecond = date.getMilliseconds();
    return (
      [year, month, day].map(formatNumber).join("/") +
      " " +
      [hour, minute, second].map(formatNumber).join(":") +
      "." +
      milliSecond
    );
  }
  function formatNumber(n) {
    let nStr;
    nStr = n.toString();
    return nStr[1] ? nStr : "0" + nStr;
  }

export default buryingPointPostOwn